package com.wn.cl.park.model.enums;

import lombok.Getter;

@Getter
public enum DmhStatusString {

    OVERDUE("overdue:", "超时未支付次数");





    private String constant;
    private String describe;
    DmhStatusString(String constant, String describe) {
        this.constant = constant;
        this.describe = describe;
    }
    /**
     * 通过编码找到枚举对象
     */
    public static DmhStatusString matchCode(String constant) {
        DmhStatusString status = null;
        //values()方法是枚举类自带的方法，获取当前所有枚举项的数组
        DmhStatusString[] values = values();
        for (DmhStatusString value : values) {
            if (value.getConstant() == constant) {
                status = value;
                break;
            }
        }
        return status;
    }
    /**
     * 通过描述找到枚举对象
     */
    public static DmhStatusString matchDescribe(String describe) {
        DmhStatusString status = null;
        DmhStatusString[] values = values();
        for (DmhStatusString OrderStatus : values) {
            if (OrderStatus.getDescribe().equals(describe)) {
                status = OrderStatus;
                break;
            }
        }
        return status;
    }
}